home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / DTSCPlusLibrary / Sources / TimerTest.cp < prev    next >
Encoding:
Text File  |  1993-01-14  |  1.6 KB  |  55 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992-93 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Programmer: Kent Sandvik
  5.   Date: 12/14/92
  6.   Revision comments are at the end of this file.
  7.   ---
  8.   TTimer is a simple timing class that could provide both 10 lap time values as well as
  9.   final values.
  10.   TTimerTest.cp contains the TTimer test functions.
  11.   _________________________________________________________________________________________________________ */
  12.  
  13. #ifndef _TIMER_
  14. #include "Timer.h"
  15. #endif
  16.  
  17. // This simple test is testing out the TTimer class, taking lap values as well
  18. // as final values.
  19.  
  20. const kSecond = 60;                                // definition of a second
  21.  
  22.  
  23. void main(void)
  24. {
  25.     cout << "Start of TTimer test…\n";
  26.  
  27.     // create a TTimer class
  28.     TTimer myTimer;
  29.  
  30.     myTimer.Start();
  31.     Delay(kSecond * 1, NULL);                    // 1 second delay
  32.  
  33.     cout << "Get Lap time = " << myTimer.GetLap() << " ticks\n";
  34.  
  35.     myTimer.SetLap(3);                            // set the third lap counter    
  36.     Delay(kSecond * 2, NULL);
  37.     myTimer.Stop();                                // 2 second delay
  38.  
  39.     cout << "Time between start and stop = " << myTimer.GetTicks() << " ticks\n";
  40.     cout << "Or in seconds = " << myTimer.GetSeconds() << " s\n";
  41.     cout << "Lap counter 3 is = " << myTimer.GetLap(3) << " ticks\n";
  42.  
  43.     cout << "End of the TTimer test!\n";
  44. }
  45.  
  46.  
  47. // _________________________________________________________________________________________________________ //
  48.  
  49.  
  50. /*    Change History (most recent last):
  51.   No        Init.    Date        Comment
  52.   1            khs        12/14/92    New file
  53.   2            khs        1/3/93        Cleanup
  54. */
  55.